package dimen;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

public class DimenDefaultTool {

	public static void gen() {
		try {
			StringBuffer sb = new StringBuffer("<resources>\r\n");
			for (int i = 0; i < 100; i++) {
				sb.append("<dimen name=\"sp" + i + "\">" + i + "sp</dimen>\r\n");
			}

			for (int i = 0; i < 500; i = i + 5) {
				sb.append("<dimen name=\"dp" + i + "\">" + i + "dp</dimen>\r\n");
			}
			sb.append("</resources>\r\n");

			writeFile("res/values/dimens.xml", sb.toString());
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
		}
	}

	public static void writeFile(String file, String text) {
		PrintWriter out = null;
		try {
			out = new PrintWriter(new BufferedWriter(new FileWriter(file)));
			out.println(text);
		} catch (IOException e) {
			e.printStackTrace();
		}

		out.close();
	}

	public static void main(String[] args) {
		gen();
	}
}
